package com.example.springblog.controller;

import com.example.springblog.mapper.BlogInfoMapper;
import com.example.springblog.moder.Blog;
import com.example.springblog.moder.Result;
import com.example.springblog.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private BlogService blogService;

    @RequestMapping("/getList")
    public List<Blog> getList(){
        return blogService.getList();
    }

    @RequestMapping("/getBlogDetail")
    public Blog getBlogDetail(Integer blogId){
        return blogService.getBlogDetail(blogId);
    }

//    @RequestMapping("/add")
//    public boolean publishBlog(String title, String content, HttpServletRequest request){
//        Blog blog = new Blog();
//        blog.setTitle(title);
//        blog.setContent(content);
//       return Result.success(blogService.)
//    }
}
